import request from '@/utils/request'
// import { getToken } from '@/utils/storage'

export const getArticlesApi = (params) => {
//   const token = getToken()
  return request.get('/h5/interview/query', {
    params: {
      current: params.current,
      sorter: params.sorter,
      pageSize: 10
    }
  })
}

export const getArticlesDetailApi = (id) => {
  return request.get('/h5/interview/show', {
    params: {
      id
    }
  })
}

export const updateLikeApi = (id) => {
  return request.post('/h5/interview/opt', {
    id,
    optType: 1 // 喜欢
  })
}

export const updateCollectApi = (id) => {
  return request.post('/h5/interview/opt', {
    id,
    optType: 2 // 收藏
  })
}

export const getLikeApi = (params) => {
  return request.get('/h5/interview/opt/list', {
    params: {
      optType: 1,
      pageSize: 10,
      page: params.current
    }
  })
}

export const getCollectApi = (params) => {
  return request.get('/h5/interview/opt/list', {
    params: {
      optType: 2,
      pageSize: 10,
      page: params.current
    }
  })
}
